home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / DatabaseAccess.a < prev    next >
Encoding:
Text File  |  1996-01-24  |  10.0 KB  |  434 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        DatabaseAccess.a
  3. ;
  4. ;    Contains:    Database Access Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__DATABASEACCESS__') = 'UNDEFINED' THEN
  21. __DATABASEACCESS__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__RESOURCES__') = 'UNDEFINED' THEN
  25.     include 'Resources.a'
  26.     ENDIF
  27. ;        include 'Types.a'                                            ;
  28. ;            include 'ConditionalMacros.a'                            ;
  29. ;        include 'MixedMode.a'                                        ;
  30. ;        include 'Files.a'                                            ;
  31. ;            include 'OSUtils.a'                                    ;
  32. ;                include 'Memory.a'                                    ;
  33. ;            include 'Finder.a'                                        ;
  34.  
  35. typeNone                        EQU        'none'
  36. typeDate                        EQU        'date'
  37. typeTime                        EQU        'time'
  38. typeTimeStamp                    EQU        'tims'
  39. typeDecimal                        EQU        'deci'
  40. typeMoney                        EQU        'mone'
  41. typeVChar                        EQU        'vcha'
  42. typeVBin                        EQU        'vbin'
  43. typeLChar                        EQU        'lcha'
  44. typeLBin                        EQU        'lbin'
  45. typeDiscard                        EQU        'disc'
  46. ; "dummy" types for DBResultsToText 
  47. typeUnknown                        EQU        'unkn'
  48. typeColBreak                    EQU        'colb'
  49. typeRowBreak                    EQU        'rowb'
  50. ; pass this in to DBGetItem for any data type 
  51. typeAnyType                        EQU        0
  52.  
  53. ; infinite timeout value for DBGetItem 
  54. ; messages for status functions for DBStartQuery 
  55. kDBUpdateWind                    EQU        0
  56. kDBAboutToInit                    EQU        1
  57. kDBInitComplete                    EQU        2
  58. kDBSendComplete                    EQU        3
  59. kDBExecComplete                    EQU        4
  60. kDBStartQueryComplete            EQU        5
  61.  
  62. ; messages for status functions for DBGetQueryResults 
  63. kDBGetItemComplete                EQU        6
  64. kDBGetQueryResultsComplete        EQU        7
  65. kDBWaitForever                    EQU        -1
  66. ;  flags for DBGetItem  
  67. kDBLastColFlag                    EQU        $0001
  68. kDBNullFlag                        EQU        $0004
  69.  
  70. ; typedef OSType             DBType
  71. ; typedef struct DBAsyncParamBlockRec  DBAsyncParamBlockRec, *DBAsyncParmBlkPtr
  72. DBAsyncParamBlockRec     RECORD    0
  73. completionProc             ds.l   1        ; offset: $0 (0)        ; pointer to completion routine 
  74. result                     ds.w   1        ; offset: $4 (4)        ; result of call 
  75. userRef                     ds.l   1        ; offset: $6 (6)        ; for application's use 
  76. ddevRef                     ds.l   1        ; offset: $A (10)        ; for ddev's use 
  77. reserved                 ds.l   1        ; offset: $E (14)        ; for internal use 
  78. sizeof                     EQU *            ; size:   $12 (18)
  79.                         ENDR
  80.  
  81. ResListElem             RECORD    0
  82. theType                     ds.l   1        ; offset: $0 (0)        ; resource type 
  83. id                         ds.w   1        ; offset: $4 (4)        ; resource id 
  84. sizeof                     EQU *            ; size:   $6 (6)
  85.                         ENDR
  86.  
  87. ; typedef struct ResListElem  ResListElem
  88. ; typedef ResListElem         *ResListPtr, **ResListHandle
  89. ; structure for query list in QueryRecord 
  90. ; typedef Handle             QueryArray[256]
  91. QueryRecord             RECORD    0
  92. version                     ds.w   1        ; offset: $0 (0)        ; version 
  93. id                         ds.w   1        ; offset: $2 (2)        ; id of 'qrsc' this came from 
  94. queryProc                 ds.l   1        ; offset: $4 (4)        ; handle to query def proc 
  95. ddevName                 ds.l   16        ; offset: $8 (8)        ; ddev name 
  96. host                     ds.l   64        ; offset: $48 (72)        ; host name 
  97. user                     ds.l   64        ; offset: $148 (328)    ; user name 
  98. password                 ds.l   64        ; offset: $248 (584)    ; password 
  99. connStr                     ds.l   64        ; offset: $348 (840)    ; connection string 
  100. currQuery                 ds.w   1        ; offset: $448 (1096)    ; index of current query 
  101. numQueries                 ds.w   1        ; offset: $44A (1098)    ; number of queries in list 
  102. queryList                 ds.l   1        ; offset: $44C (1100)    ; handle to array of handles to text 
  103. numRes                     ds.w   1        ; offset: $450 (1104)    ; number of resources in list 
  104. resList                     ds.l   1        ; offset: $452 (1106)    ; handle to array of resource list elements 
  105. dataHandle                 ds.l   1        ; offset: $456 (1110)    ; for use by query def proc 
  106. refCon                     ds.l   1        ; offset: $45A (1114)    ; for use by application 
  107. sizeof                     EQU *            ; size:   $45E (1118)
  108.                         ENDR
  109.  
  110. ; typedef struct QueryRecord  QueryRecord
  111. ; typedef QueryRecord         *QueryPtr, **QueryHandle
  112. ; structure of column types array in ResultsRecord 
  113. ; typedef DBType             ColTypesArray[256]
  114. DBColInfoRecord         RECORD    0
  115. len                         ds.w   1        ; offset: $0 (0)
  116. places                     ds.w   1        ; offset: $2 (2)
  117. flags                     ds.w   1        ; offset: $4 (4)
  118. sizeof                     EQU *            ; size:   $6 (6)
  119.                         ENDR
  120.  
  121. ; typedef struct DBColInfoRecord  DBColInfoRecord
  122. ; typedef DBColInfoRecord     ColInfoArray[256]
  123. ResultsRecord             RECORD    0
  124. numRows                     ds.w   1        ; offset: $0 (0)        ; number of rows in result 
  125. numCols                     ds.w   1        ; offset: $2 (2)        ; number of columns per row 
  126. colTypes                 ds.l   1        ; offset: $4 (4)        ; data type array 
  127. colData                     ds.l   1        ; offset: $8 (8)        ; actual results 
  128. colInfo                     ds.l   1        ; offset: $C (12)        ; DBColInfoRecord array 
  129. sizeof                     EQU *            ; size:   $10 (16)
  130.                         ENDR
  131.  
  132. ; typedef struct ResultsRecord  ResultsRecord
  133. ;
  134. ; pascal OSErr InitDBPack(void)
  135. ;
  136.     IF ¬ GENERATINGCFM THEN
  137.         Macro
  138.         _InitDBPack
  139.             move.w    #$0004,-(sp)
  140.             move.w    #$0100,d0
  141.             dc.w     $A82F
  142.         EndM
  143.     ELSE
  144.         IMPORT_CFM_FUNCTION    InitDBPack
  145.     ENDIF
  146.  
  147. ;
  148. ; pascal OSErr DBInit(long *sessID, ConstStr63Param ddevName, ConstStr255Param host, ConstStr255Param user, ConstStr255Param passwd, ConstStr255Param connStr, DBAsyncParmBlkPtr asyncPB)
  149. ;
  150.     IF ¬ GENERATINGCFM THEN
  151.         Macro
  152.         _DBInit
  153.             move.w    #$0E02,d0
  154.             dc.w     $A82F
  155.         EndM
  156.     ELSE
  157.         IMPORT_CFM_FUNCTION    DBInit
  158.     ENDIF
  159.  
  160. ;
  161. ; pascal OSErr DBEnd(long sessID, DBAsyncParmBlkPtr asyncPB)
  162. ;
  163.     IF ¬ GENERATINGCFM THEN
  164.         Macro
  165.         _DBEnd
  166.             move.w    #$0403,d0
  167.             dc.w     $A82F
  168.         EndM
  169.     ELSE
  170.         IMPORT_CFM_FUNCTION    DBEnd
  171.     ENDIF
  172.  
  173. ;
  174. ; pascal OSErr DBGetConnInfo(long sessID, short sessNum, long *returnedID, long *version, Str63 ddevName, Str255 host, Str255 user, Str255 network, Str255 connStr, long *start, OSErr *state, DBAsyncParmBlkPtr asyncPB)
  175. ;
  176.     IF ¬ GENERATINGCFM THEN
  177.         Macro
  178.         _DBGetConnInfo
  179.             move.w    #$1704,d0
  180.             dc.w     $A82F
  181.         EndM
  182.     ELSE
  183.         IMPORT_CFM_FUNCTION    DBGetConnInfo
  184.     ENDIF
  185.  
  186. ;
  187. ; pascal OSErr DBGetSessionNum(long sessID, short *sessNum, DBAsyncParmBlkPtr asyncPB)
  188. ;
  189.     IF ¬ GENERATINGCFM THEN
  190.         Macro
  191.         _DBGetSessionNum
  192.             move.w    #$0605,d0
  193.             dc.w     $A82F
  194.         EndM
  195.     ELSE
  196.         IMPORT_CFM_FUNCTION    DBGetSessionNum
  197.     ENDIF
  198.  
  199. ;
  200. ; pascal OSErr DBSend(long sessID, Ptr text, short len, DBAsyncParmBlkPtr asyncPB)
  201. ;
  202.     IF ¬ GENERATINGCFM THEN
  203.         Macro
  204.         _DBSend
  205.             move.w    #$0706,d0
  206.             dc.w     $A82F
  207.         EndM
  208.     ELSE
  209.         IMPORT_CFM_FUNCTION    DBSend
  210.     ENDIF
  211.  
  212. ;
  213. ; pascal OSErr DBSendItem(long sessID, DBType dataType, short len, short places, short flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  214. ;
  215.     IF ¬ GENERATINGCFM THEN
  216.         Macro
  217.         _DBSendItem
  218.             move.w    #$0B07,d0
  219.             dc.w     $A82F
  220.         EndM
  221.     ELSE
  222.         IMPORT_CFM_FUNCTION    DBSendItem
  223.     ENDIF
  224.  
  225. ;
  226. ; pascal OSErr DBExec(long sessID, DBAsyncParmBlkPtr asyncPB)
  227. ;
  228.     IF ¬ GENERATINGCFM THEN
  229.         Macro
  230.         _DBExec
  231.             move.w    #$0408,d0
  232.             dc.w     $A82F
  233.         EndM
  234.     ELSE
  235.         IMPORT_CFM_FUNCTION    DBExec
  236.     ENDIF
  237.  
  238. ;
  239. ; pascal OSErr DBState(long sessID, DBAsyncParmBlkPtr asyncPB)
  240. ;
  241.     IF ¬ GENERATINGCFM THEN
  242.         Macro
  243.         _DBState
  244.             move.w    #$0409,d0
  245.             dc.w     $A82F
  246.         EndM
  247.     ELSE
  248.         IMPORT_CFM_FUNCTION    DBState
  249.     ENDIF
  250.  
  251. ;
  252. ; pascal OSErr DBGetErr(long sessID, long *err1, long *err2, Str255 item1, Str255 item2, Str255 errorMsg, DBAsyncParmBlkPtr asyncPB)
  253. ;
  254.     IF ¬ GENERATINGCFM THEN
  255.         Macro
  256.         _DBGetErr
  257.             move.w    #$0E0A,d0
  258.             dc.w     $A82F
  259.         EndM
  260.     ELSE
  261.         IMPORT_CFM_FUNCTION    DBGetErr
  262.     ENDIF
  263.  
  264. ;
  265. ; pascal OSErr DBBreak(long sessID, Boolean abort, DBAsyncParmBlkPtr asyncPB)
  266. ;
  267.     IF ¬ GENERATINGCFM THEN
  268.         Macro
  269.         _DBBreak
  270.             move.w    #$050B,d0
  271.             dc.w     $A82F
  272.         EndM
  273.     ELSE
  274.         IMPORT_CFM_FUNCTION    DBBreak
  275.     ENDIF
  276.  
  277. ;
  278. ; pascal OSErr DBGetItem(long sessID, long timeout, DBType *dataType, short *len, short *places, short *flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  279. ;
  280.     IF ¬ GENERATINGCFM THEN
  281.         Macro
  282.         _DBGetItem
  283.             move.w    #$100C,d0
  284.             dc.w     $A82F
  285.         EndM
  286.     ELSE
  287.         IMPORT_CFM_FUNCTION    DBGetItem
  288.     ENDIF
  289.  
  290. ;
  291. ; pascal OSErr DBUnGetItem(long sessID, DBAsyncParmBlkPtr asyncPB)
  292. ;
  293.     IF ¬ GENERATINGCFM THEN
  294.         Macro
  295.         _DBUnGetItem
  296.             move.w    #$040D,d0
  297.             dc.w     $A82F
  298.         EndM
  299.     ELSE
  300.         IMPORT_CFM_FUNCTION    DBUnGetItem
  301.     ENDIF
  302.  
  303. ;
  304. ; pascal OSErr DBKill(DBAsyncParmBlkPtr asyncPB)
  305. ;
  306.     IF ¬ GENERATINGCFM THEN
  307.         Macro
  308.         _DBKill
  309.             move.w    #$020E,d0
  310.             dc.w     $A82F
  311.         EndM
  312.     ELSE
  313.         IMPORT_CFM_FUNCTION    DBKill
  314.     ENDIF
  315.  
  316. ;
  317. ; pascal OSErr DBGetNewQuery(short queryID, QueryHandle *query)
  318. ;
  319.     IF ¬ GENERATINGCFM THEN
  320.         Macro
  321.         _DBGetNewQuery
  322.             move.w    #$030F,d0
  323.             dc.w     $A82F
  324.         EndM
  325.     ELSE
  326.         IMPORT_CFM_FUNCTION    DBGetNewQuery
  327.     ENDIF
  328.  
  329. ;
  330. ; pascal OSErr DBDisposeQuery(QueryHandle query)
  331. ;
  332.     IF ¬ GENERATINGCFM THEN
  333.         Macro
  334.         _DBDisposeQuery
  335.             move.w    #$0210,d0
  336.             dc.w     $A82F
  337.         EndM
  338.     ELSE
  339.         IMPORT_CFM_FUNCTION    DBDisposeQuery
  340.     ENDIF
  341.  
  342. ;
  343. ; pascal OSErr DBStartQuery(long *sessID, QueryHandle query, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  344. ;
  345.     IF ¬ GENERATINGCFM THEN
  346.         Macro
  347.         _DBStartQuery
  348.             move.w    #$0811,d0
  349.             dc.w     $A82F
  350.         EndM
  351.     ELSE
  352.         IMPORT_CFM_FUNCTION    DBStartQuery
  353.     ENDIF
  354.  
  355. ;
  356. ; pascal OSErr DBGetQueryResults(long sessID, ResultsRecord *results, long timeout, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  357. ;
  358.     IF ¬ GENERATINGCFM THEN
  359.         Macro
  360.         _DBGetQueryResults
  361.             move.w    #$0A12,d0
  362.             dc.w     $A82F
  363.         EndM
  364.     ELSE
  365.         IMPORT_CFM_FUNCTION    DBGetQueryResults
  366.     ENDIF
  367.  
  368. ;
  369. ; pascal OSErr DBResultsToText(ResultsRecord *results, Handle *theText)
  370. ;
  371.     IF ¬ GENERATINGCFM THEN
  372.         Macro
  373.         _DBResultsToText
  374.             move.w    #$0413,d0
  375.             dc.w     $A82F
  376.         EndM
  377.     ELSE
  378.         IMPORT_CFM_FUNCTION    DBResultsToText
  379.     ENDIF
  380.  
  381. ;
  382. ; pascal OSErr DBInstallResultHandler(DBType dataType, DBResultHandlerUPP theHandler, Boolean isSysHandler)
  383. ;
  384.     IF ¬ GENERATINGCFM THEN
  385.         Macro
  386.         _DBInstallResultHandler
  387.             move.w    #$0514,d0
  388.             dc.w     $A82F
  389.         EndM
  390.     ELSE
  391.         IMPORT_CFM_FUNCTION    DBInstallResultHandler
  392.     ENDIF
  393.  
  394. ;
  395. ; pascal OSErr DBRemoveResultHandler(DBType dataType)
  396. ;
  397.     IF ¬ GENERATINGCFM THEN
  398.         Macro
  399.         _DBRemoveResultHandler
  400.             move.w    #$0215,d0
  401.             dc.w     $A82F
  402.         EndM
  403.     ELSE
  404.         IMPORT_CFM_FUNCTION    DBRemoveResultHandler
  405.     ENDIF
  406.  
  407. ;
  408. ; pascal OSErr DBGetResultHandler(DBType dataType, DBResultHandlerUPP *theHandler, Boolean getSysHandler)
  409. ;
  410.     IF ¬ GENERATINGCFM THEN
  411.         Macro
  412.         _DBGetResultHandler
  413.             move.w    #$0516,d0
  414.             dc.w     $A82F
  415.         EndM
  416.     ELSE
  417.         IMPORT_CFM_FUNCTION    DBGetResultHandler
  418.     ENDIF
  419.  
  420. ;
  421. ; pascal OSErr DBIdle(void)
  422. ;
  423.     IF ¬ GENERATINGCFM THEN
  424.         Macro
  425.         _DBIdle
  426.             move.w    #$00FF,d0
  427.             dc.w     $A82F
  428.         EndM
  429.     ELSE
  430.         IMPORT_CFM_FUNCTION    DBIdle
  431.     ENDIF
  432.  
  433.     ENDIF ; __DATABASEACCESS__
  434.